package com.yunyi.mapper;

import com.yunyi.entity.mysql.ChatMessageEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ChatMessageMysqlMapper {

    /**
     * 插入messages
     *
     * @param messages msg信息
     */
    void insertMessages(@Param("messages") List<ChatMessageEntity> messages);

    /**
     * 根据会话id查询
     *
     * @param conversationId 会话id
     * @return 聊天记录
     */
    List<ChatMessageEntity> findLastNMessages(@Param("conversationId") String conversationId);

    /**
     * 删除
     *
     * @param conversationId 会话id
     */
    void deleteByConversationId(String conversationId);
}
